<template>
  <div class="login-container">
    <div class="login-box">
      <a-input v-model:value="state.form.username" placeholder="用户名" />
      <a-input-password v-model:value="state.form.password" placeholder="密码" />
      <div class="btn">
        <a-button @click="login">登录</a-button>
      </div>
    </div>
  </div>
</template>

<script lang='ts' setup>
import { reactive, ref } from 'vue'
// import { useAuthLoginApi } from '@/api/login/auth'
import { useAuthLoginApi } from '@/api'
import { Session } from '@/utils/storage'
const state = reactive({
  form: {
    username: '',
    password: ''
  }
})

const login = async () => {
  // let { token } = await useAuthLoginApi(state.form)
  // Session.set("token", token)
  // console.log(token)
    let data = await useAuthLoginApi(state.form)
    console.log(data)
}
</script>
<style scoped lang='scss'>
.login-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(45deg,
      #3f51b5 0%,
      #3f51b5 25%,

      #2196f3 25%,
      #2196f3 50%,

      #3f51b5 50%,
      #3f51b5 75%,

      #2196f3 75%,
      #2196f3 100%);

  .login-box {
    width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 40px 20px;
    border-radius: 4px;
    border: 2px solid #222;
    display: flex;
    flex-direction: column;
    align-items: center;

    .btn {
      margin-top: 40px;
    }
  }
}
</style>